<?php
header("Content-Type:text/html;charset=utf-8");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录</title>
<link rel="shortcut icon" type="text/css"  href="../img/facicon.ico" />
<style type="text/css">
html,body{
	margin:0px;
	padding:0px;
	width:100%;
	height:100%;
}
#bg{
	width:100%;
	height:100%;
	background-color: #D2D1D0;
	position:relative;
}
#logo_content{
	position:absolute;
	top:50px;
	width:360px;
	left:50%;
	margin-left:-180px;
	background-color:#f4f4f4;
	height:280px;
}
form {
	margin:10px 0 0 30px;
}
form label{
	display:inline-block;
	width:60px;
	text-align: right;
	letter-spacing: 2px;
}
form input.input{
	width:180px;
}
#tishi{
	font-size:13px;
	margin-left:10px;
}
</style>
<script src="../js/basic.js"></script>
<script type="text/javascript">
	window.onload=function(){
		addEvent(document.forms[0],"submit",function(event){
			preventDefault(event);
			var username=document.forms[0].elements["username"].value;
			var password=document.forms[0].elements["password"].value;
			get_ajax("../back_stage/login_stage.php",{login:true,username:username,password:password},function(text){
				if(text=="ok"){
					document.getElementById("tishi").innerHTML="登陆成功";
					var go_current="<?= $_SESSION["current_page"]?>";
					if(go_current!=""){
						window.open(go_current,"_self");
					}else{
						window.open("user_center.php","_self");
					}
				}else{
					document.getElementById("tishi").innerHTML=text;
				}	
			},false);
		});
	}
</script>
</head>

<body>
<div id="bg">
	<div id="logo_content">
		<div style="font-size:20px">用户登录</div>
		<form method="post">
			<p><label for="username">用户名</label><input class="input" type="text" name="username" id="username" /></p>
			<p><label for="password">密码</label><input class="input" type="password" name="password" id="password" /></p>
			<p><input style="width:80px" type="submit" value="提交" /><span id="tishi"></span></p>
		</form>
	</div>
</div>
</body>
</html>